1 /* 2 * This file is part of gtkD. 3 * 4 * gtkD is free software; you can redistribute it and/or modify 5 * it under the terms of the GNU Lesser General Public License 6 * as published by the Free Software Foundation; either version 3 7 * of the License, or (at your option) any later version, with 8 * some exceptions, please read the COPYING file. 9 * 10 * gtkD is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU Lesser General Public License for more details. 14 * 15 * You should have received a copy of the GNU Lesser General Public License 16 * along with gtkD; if not, write to the Free Software 17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA 18 */ 19 20 // generated automatically - do not change 21 // find conversion definition on APILookup.txt 22 // implement new conversion functionalities on the wrap.utils pakage 23 24 25 module adw.Window; 26 27 private import adw.c.functions; 28 public import adw.c.types; 29 private import glib.ConstructionException; 30 private import gobject.ObjectG; 31 private import gtk.AccessibleIF; 32 private import gtk.AccessibleT; 33 private import gtk.BuildableIF; 34 private import gtk.BuildableT; 35 private import gtk.ConstraintTargetIF; 36 private import gtk.ConstraintTargetT; 37 private import gtk.NativeIF; 38 private import gtk.NativeT; 39 private import gtk.RootIF; 40 private import gtk.RootT; 41 private import gtk.ShortcutManagerIF; 42 private import gtk.ShortcutManagerT; 43 private import gtk.Widget; 44 private import gtk.Window : DGtkWindow = Window; 45 46 47 /** 48 * A freeform window. 49 * 50 * <picture> 51 * <source srcset="window-dark.png" media="(prefers-color-scheme: dark)"> 52 * <img src="window.png" alt="window"> 53 * </picture> 54 * 55 * The `AdwWindow` widget is a subclass of [class@Gtk.Window] which has no 56 * titlebar area. It means [class@Gtk.HeaderBar] can be used as follows: 57 * 58 * ```xml 59 * <object class="AdwWindow"> 60 * <property name="content"> 61 * <object class="GtkBox"> 62 * <property name="orientation">vertical</property> 63 * <child> 64 * <object class="GtkHeaderBar"/> 65 * </child> 66 * <child> 67 * <!-- ... --> 68 * </child> 69 * </object> 70 * </property> 71 * </object> 72 * ``` 73 * 74 * Using [method@Gtk.Window.get_titlebar] and [method@Gtk.Window.set_titlebar] 75 * is not supported and will result in a crash. 76 * 77 * Since: 1.0 78 */ 79 public class Window : DGtkWindow 80 { 81 /** the main Gtk struct */ 82 protected AdwWindow* adwWindow; 83 84 /** Get the main Gtk struct */ 85 public AdwWindow* getAdwWindowStruct(bool transferOwnership = false) 86 { 87 if (transferOwnership) 88 ownedRef = false; 89 return adwWindow; 90 } 91 92 /** the main Gtk struct as a void* */ 93 protected override void* getStruct() 94 { 95 return cast(void*)adwWindow; 96 } 97 98 /** 99 * Sets our main struct and passes it to the parent class. 100 */ 101 public this (AdwWindow* adwWindow, bool ownedRef = false) 102 { 103 this.adwWindow = adwWindow; 104 super(cast(GtkWindow*)adwWindow, ownedRef); 105 } 106 107 /** 108 * You should use `setContent(Widget)` instead 109 */ 110 override void setChild(Widget child) 111 { 112 setContent(child); 113 } 114 115 /** 116 */ 117 118 /** */ 119 public static GType getType() 120 { 121 return adw_window_get_type(); 122 } 123 124 /** 125 * Creates a new `AdwWindow`. 126 * 127 * Returns: the newly created `AdwWindow` 128 * 129 * Since: 1.0 130 * 131 * Throws: ConstructionException GTK+ fails to create the object. 132 */ 133 public this() 134 { 135 auto __p = adw_window_new(); 136 137 if(__p is null) 138 { 139 throw new ConstructionException("null returned by new"); 140 } 141 142 this(cast(AdwWindow*) __p); 143 } 144 145 /** 146 * Gets the content widget of @self. 147 * 148 * This method should always be used instead of [method@Gtk.Window.get_child]. 149 * 150 * Returns: the content widget of @self 151 * 152 * Since: 1.0 153 */ 154 public Widget getContent() 155 { 156 auto __p = adw_window_get_content(adwWindow); 157 158 if(__p is null) 159 { 160 return null; 161 } 162 163 return ObjectG.getDObject!(Widget)(cast(GtkWidget*) __p); 164 } 165 166 /** 167 * Sets the content widget of @self. 168 * 169 * This method should always be used instead of [method@Gtk.Window.set_child]. 170 * 171 * Params: 172 * content = the content widget 173 * 174 * Since: 1.0 175 */ 176 public void setContent(Widget content) 177 { 178 adw_window_set_content(adwWindow, (content is null) ? null : content.getWidgetStruct()); 179 } 180 }